<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ include file="/cms/include/init_admin.jsp" %>
<%@ page import="com.qbooks.cms.homepage.*" %>
<%

	HashList codeUseYn	= CommonUtil.getCodeList("use_yn");	//사용여부
	HashList codeAuth	= CommonUtil.getCodeList("014");	//게시판권한
	


	String job_type		= StringUtil.nvl(request.getParameter("job_type"),"U");
	String board_id		= StringUtil.nvl(request.getParameter("board_id"));


	HashMap param = new HashMap();
	param.put("board_id",	board_id);


	HomepageDAO dao 	= new HomepageDAO();

	HashList info 	= dao.selectBoardInfo(param);

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title><%= SYSTEM_NAME %></title>
	<%@ include file="/cms/include/cssnjs.jsp"  %>

	<script type="text/javascript">

	$(document).ready(function() {

		/* 탭 클릭 */
		$('li', '#tabs').click(function(){
		    $('.on', '#tabs').removeClass('on').addClass('off');
		    $(this).addClass('on');

			$('#tabs-1:not(.hidden),#tabs-2:not(.hidden),#tabs-3:not(.hidden)').addClass('hidden');
			$('#tabs-'+$(this).attr('code')).removeClass('hidden');
		});

		$('#list').find('input').change(function() {
			$(this).closest('tr').find('input[name="list.job_type"]').val('U');
		});

	});


	function fnSave() {
		if (confirm(MSG_<%=job_type%>)) {
			$('#saveForm').attr('action', './boardSave.do');
			$('#saveForm').submit();
		}
	}


	function fnDelete() {
		if (confirm(MSG_D)) {
			$('#job_type').val('D');
			$('#saveForm').attr('action', './boardSave.do');
			$('#saveForm').submit();
		}
	}

	</script>
</head>
<body>
<div id="wrap">
	<div id="top">
		<%@ include file="/cms/include/top.jsp" %>
	</div>
	<div id="page">
		<div id="menu">
			<%@ include file="/cms/include/leftMenu.jsp" %>
		</div>
		<div id="contents">
			<div class="menu_title">
				<h1>게시판관리</h1>
				<p>CMS > 홈페이지  > <b>게시판관리</b></p>
			</div>
			<div class="clear line_01"></div>

			<ul id="tabs" class="tab_01 mt15">
			    <li class="on"  code="1"><p>1. 기본사항</p></li>
		<%	if ("U".equals(job_type)) { %>
			    <li class="off" code="2"><p>2. 게시글</p></li>
		<%	} %>
			</ul>

			<div id="tabs-1" class="mt15">
				<form id="saveForm" method="post" action="">
				<input type="hidden" name="job_type" id="job_type" value="<%= job_type %>"/>
				<input type="hidden" name="board_id" id="board_id" value="<%= board_id %>"/>

				<table cellpadding="0" cellspacing="0" class="table_01 mt5">
				<colgroup>
					<col width="100px"/>
					<col/>
				</colgroup>
				<tbody>
					<tr>
						<th><p>게시판명</p></th>
						<td class="brx">
							<input type="text" name="board_name" value="<%= info.get("board_name", 0) %>" class="w200"/>
						</td>
					</tr>
					<tr>
						<th><p>새글 표시기준</p></th>
						<td class="brx">
							<input type="text" name="new_period" value="<%= info.get("new_period", 0) %>" class="w100 r"/>일 동안
						</td>
					</tr>
					<tr>
						<th><p>히트글 표시기준</p></th>
						<td class="brx">
							<input type="text" name="hit_count" value="<%= info.get("hit_count", 0) %>" class="w100 r"/>번 이상 조회시
						</td>
					</tr>
					<tr>
						<th><p>에디터 사용여부</p></th>
						<td class="brx">
							<%= StringUtil.makeRadio(codeUseYn, "editor_yn", StringUtil.nvl(info.get("editor_yn", 0),"N")) %>
						</td>
					</tr>
					<tr>
						<th><p>답글</p></th>
						<td class="brx">
							<%= StringUtil.makeRadio(codeUseYn, "reply_yn", StringUtil.nvl(info.get("reply_yn", 0),"N")) %>
	        			</td>
					</tr>
					<tr>
						<th><p>코멘트</p></th>
						<td class="brx">
							<%= StringUtil.makeRadio(codeUseYn, "comment_yn", StringUtil.nvl(info.get("comment_yn", 0),"N")) %>
						</td>
					</tr>
					<tr>
						<th><p>비밀글 사용여부</p></th>
						<td class="brx">
							<%= StringUtil.makeRadio(codeUseYn, "secret_yn", StringUtil.nvl(info.get("secret_yn", 0),"N")) %>
					    </td>
					</tr>
					<tr>
						<th><p>쓰기권한</p></th>
						<td class="brx">
							<%= StringUtil.makeRadio(codeAuth, "write_auth", info.get("write_auth", 0)) %>
					    </td>
					</tr>
					<tr>
						<th><p>읽기권한</p></th>
						<td class="brx">
							<%= StringUtil.makeRadio(codeAuth, "read_auth", info.get("read_auth", 0)) %>
					    </td>
					</tr>
					<tr>
						<th><p>사용여부</p></th>
						<td class="brx">
							<%= StringUtil.makeRadio(codeUseYn, "use_yn", StringUtil.nvl(info.get("use_yn", 0),"Y")) %>
						</td>
					</tr>
				</tbody>
				</table>

				<div class="mt20 mb10 c">
					<a href="./boardList.jsp"><img src="/images/cms/btn_list.gif"/></a>
			<%	if ("U".equals(job_type)) { %>
					<a href="#nohref" onclick="fnSave()"><img src="/images/cms/btn_update.gif" /></a>
					<a href="#nohref" onclick="fnDelete()"><img src="/images/cms/btn_delete.gif" /></a>
			<%	} else if ("C".equals(job_type)) { %>
					<a href="#nohref" onclick="fnSave()"><img src="/images/cms/btn_register.gif" /></a>
			<%	} %>
				</div>

				</form>

			</div>



			<!-- 상품가격 -->
			<div id="tabs-2" class="hidden mt15">

				<form id="priceSaveForm" method="post" action="./enjoyPriceSave.do">
				<input type="hidden" name="board_id" id="board_id" value="<%= board_id %>"/>

				<table cellpadding="0" cellspacing="0" class="table_03 mt5">
				<colgroup>
					<col width="40px"/>
					<col width="300px" />
					<col width="80px"/>
					<col width="80px"/>
					<col width="80px"/>
					<col width="80px"/>
					<col width="80px"/>
					<col width="80px"/>
				</colgroup>
				<tbody id="list">
					<tr>
						<th rowspan="2"><p><input type="checkbox" name="chkAll" id="chkAll"/></p></th>
						<th rowspan="2"><p>상품명</p></th>
						<th colspan="3"><p>어른</p></th>
						<th colspan="3" class="brx"><p>소아</p></th>
					</tr>
					<tr>
						<th><p>cost</p></th>
						<th><p>sales</p></th>
						<th><p>b2b</p></th>
						<th><p>cost</p></th>
						<th><p>sales</p></th>
						<th class="brx"><p>b2b</p></th>
					</tr>


				</tbody>
				</table>

				<div class="mt20 mb10 c">
					<a href="./memberList.jsp"><img src="/images/cms/btn_list.gif"/></a>
					<img src="/images/cms/btn_addrow.gif" class="pointer" onclick="fnAddRow()"/>
					<img src="/images/cms/btn_delrow.gif" class="pointer" onclick="fnDeleteRow()"/>
					<a href="#nohref" onclick="fnUpdatePrice()"><img src="/images/cms/btn_save.gif" /></a>
				</div>

				</form>

			</div>



		</div>
	</div>
</div>

</body>
</html>
